package com.qhong.test;

import com.alibaba.fastjson.JSON;
import com.qhong.test.dependBean.Person;
import com.qhong.test.entity.UserDto11;
import com.qhong.test.entity.UserInfo11;
import com.qhong.test.redis.redisTest;
import org.modelmapper.ModelMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;

/**
 * Created by qhong on 2018/5/30 16:15
 **/
@Component
public class ActionMethod {

	@Autowired
	private Person person;

	@Autowired
	private redisTest rt;

	//private String name=person.getName();

	public void action () {
//		Test.printUser();
//		Test2.printUser();
		//System.exit(0);
//		System.out.println(person.toString());
//		System.out.println(getPerson().toString());
		//------------redis测试-------------
     //  rt.action();
		//System.out.println(name);
       //-------------modelmapper测试-------------
		ModelMapper modelMapper = new ModelMapper();
//		UserInfo11 userInfo11=new UserInfo11();
//		userInfo11.setEmail("email");
//		userInfo11.setName("hongda");
//		userInfo11.setPrice("200.00$");
//
//	   UserDto11	userDto = modelMapper.map(userInfo11, UserDto11.class);
//		System.out.println(JSON.toJSONString(userDto));
		UserDto11 dto=new UserDto11();
		dto.setName("hongdada");
		dto.setAddress("shanghai");
		dto.setAge(22);
		UserInfo11 info11=modelMapper.map(dto,UserInfo11.class);
		System.out.println(UserDto11.class.toString()+":"+ JSON.toJSONString(info11));



	}

	@Bean
	public Person getPerson(){
		return new Person();
	}

}
